package com.mike.employment.base;


import lombok.Data;

@Data
public class ApiResult {

	private int code;
	private String msg;
	private Object data;
	
	public static ApiResult success(Object obj) {
		  ApiResult result = new ApiResult();
		  result.setCode(200);
		  result.setMsg("success");
		  result.setData(obj);
        return result;
	}

	public static ApiResult success(String msg,Object obj) {
		  ApiResult result = new ApiResult();
		  result.setCode(200);
		  result.setMsg(msg);
		  result.setData(obj);
          return result;
	}
    
	public static ApiResult success(int code,String msg,Object obj) {
		ApiResult result = new ApiResult();
		result.setCode(code);
		result.setMsg(msg);
		result.setData(obj);
        return result;
        
	}
	
	public static ApiResult eror(int code,String msg) {
		ApiResult result = new ApiResult();
		result.setCode(code);
		result.setMsg(msg);
        return result;

	}
	
	public static ApiResult eror(int code) {
		ApiResult result = new ApiResult();
		result.setCode(code);
		result.setMsg("error");
        return result;

	}
	
}
